<template>

  <div>
   <el-menu
      :default-active="defaultActive"
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      router
      active-text-color="#ffd04b">
      <el-menu-item index="/home">
        <i class="el-icon-setting"></i>
        <span slot="title">首页</span>
      </el-menu-item>
        <el-submenu  :index="item.id.toString()" v-for="item in $store.getters.getUser.menus" :key="item.id" >
        <template slot="title">
          <i :class="item.icon"></i>
          <span>{{item.title}}</span>
        </template>

     <el-menu-item :index="menu.url" v-for="menu in item.children" :key="menu.id">{{menu.title}}</el-menu-item>

      </el-submenu>

    </el-menu>
  </div>
</template>

<script>
export default {
  data () {
    return {
      defaultActive: 'home'
    }
  },
  mounted () {
    this.defaultActive = this.$route.path
  }
}
</script>

<style lang="less" scoped>
.el-menu{
    height: 600px;
  }
</style>
